// led_test.c

#include "led_test.h"

void Led_TestBlink_Run(void)
{
    static uint32_t led0_lastTick = 0;
    static uint32_t led1_lastTick = 0;
    static GPIO_PinState led0_state = GPIO_PIN_RESET;
    static GPIO_PinState led1_state = GPIO_PIN_RESET;

    uint32_t now = HAL_GetTick();

    // LED0 每600ms翻转
    if (now - led0_lastTick >= 600)
    {
        led0_lastTick = now;
        led0_state = (led0_state == GPIO_PIN_RESET) ? GPIO_PIN_SET : GPIO_PIN_RESET;
        HAL_GPIO_WritePin(LED0_GPIO_Port, LED0_Pin, led0_state);
    }

    // LED1 每400ms翻转
    if (now - led1_lastTick >= 400)
    {
        led1_lastTick = now;
        led1_state = (led1_state == GPIO_PIN_RESET) ? GPIO_PIN_SET : GPIO_PIN_RESET;
        HAL_GPIO_WritePin(LED1_GPIO_Port, LED1_Pin, led1_state);
    }
}
